#!/bin/sh

echo "🔧 Preparing commit: install + lint + typecheck..."

pnpm i --frozen-lockfile --ignore-scripts --offline
if [ $? -ne 0 ]; then
    echo "❌ Install failed!"
    exit 1
fi

lint-staged
if [ $? -ne 0 ]; then
    echo "❌ Lint-staged failed!"
    exit 1
fi

pnpm typecheck
if [ $? -ne 0 ]; then
    echo "❌ TypeScript type check failed!"
    exit 1
fi

echo "✅ Commit preparation completed!"